package com.example.control;

import com.example.constant.UserStateConstant;
import com.example.container.ChargingPileContainer;
import com.example.entity.ChargingPile;
import com.example.entity.factory.Unpooled;
import com.example.entity.message.Message;

public class RemoteElectricControl {

	public void start(String equipmentID, byte interfaceID, String userID, byte electricWay, float parameter)
			throws Exception {
		ChargingPileContainer container = ChargingPileContainer.getInstance();
		ChargingPile chargingPile = container.get(equipmentID);
		if (chargingPile == null) {
			System.out.println("并没有这个电桩");
		} else {
			if (chargingPile.getState() == UserStateConstant.CLOSE_STATE) {
				System.out.println("该电桩已关闭");
			} else {

				Message message = Unpooled.wrapperRemoteElectricMessage(equipmentID, interfaceID, 12, userID,
						electricWay, parameter);
				chargingPile.getChannelHandlerContext().writeAndFlush(message);
			}
		}
	}

	public static void main(String[] args) {

	}
}
